Skip to content

test: freeze renderer behavior before refactoring - #118

Draft
hallerite wants to merge 4 commits into
mainfrom
codex/freeze-golden-corpus
Draft

test: freeze renderer behavior before refactoring#118
hallerite wants to merge 4 commits into
mainfrom
codex/freeze-golden-corpus

Conversation

@hallerite

@hallerite hallerite commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

  • pin every Hugging Face tokenizer and processor used by network-backed tests to a reviewed immutable revision
  • split CI into offline unit, pinned text-model parity, and pinned multimodal parity lanes
  • add consistency checks for renderer registrations, configs, model routing, exports, and golden coverage
  • add deterministic, reviewable behavior snapshots for every registered renderer, including rendered text, token digests, attribution masks, parser output, and bridge extensions
  • correct the documented bridge return type and stale multimodal documentation

Why

The renderer internals are about to undergo a substantial emission/attribution refactor. The existing suite is broad, but upstream model assets were mutable and there was no compact checked-in contract showing the complete observable output of each renderer.

This PR makes the current behavior reproducible and reviewable before implementation moves. It is intended to change test architecture and documentation, not renderer output.

Developer impact

Offline tests continue to run on Python 3.10–3.13. Network-backed text and multimodal parity tests now run in dedicated Python 3.13 jobs using immutable model revisions. Golden output changes must be regenerated explicitly and reviewed in the diff.

Validation

  • uv run ruff check .
  • uv run ruff format --check .
  • offline suite: 93 passed
  • pinned text parity: 2,481 passed, 110 skipped, 1 expected failure
  • pinned multimodal parity: 73 passed, 17 skipped
  • registry and golden contract tests: 26 passed
  • ty check renderers exits successfully with the existing advisory diagnostics

Note

Freeze renderer behavior with golden snapshot tests before refactoring

  • Adds tests/golden_renderer_outputs.json with checked-in snapshots of renderer output, generated by tests/generate_renderer_goldens.py and validated by tests/test_golden_renderer_outputs.py.
  • Introduces tests/model_assets.py with MODEL_REVISIONS (pinned full SHAs) and load_test_tokenizer, replacing direct load_tokenizer calls across all test files to ensure deterministic tokenizer loads.
  • Updates load_tokenizer in renderers/base.py to support a revision kwarg and enforce a stricter trust policy: trust_remote_code is only enabled for models in TRUSTED_REVISIONS, and callers cannot override the revision for trusted models.
  • Splits the CI Renderers job into three jobs: offline unit tests (Python 3.10–3.13), text model parity tests (network), and multimodal parity tests (network), with HF asset caching keyed by model_assets.py.
  • Adds pytest markers (network, model_parity, multimodal) to categorize tests and exclude network tests from offline runs.

Macroscope summarized a48daf6.

Comment on lines 21 to +45
@@ -38,4 +40,64 @@ jobs:
run: uv sync

- name: Run tests
run: uv run pytest tests/ -v
run: uv run pytest tests/ -m "not network" -v

model-parity:
name: Pinned model parity
runs-on: ubuntu-latest
timeout-minutes: 45
env:
HF_HUB_DISABLE_PROGRESS_BARS: "1"
RENDERERS_TEST_NETWORK: "1"
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: "3.13"

Comment on lines +46 to +75
- name: Install uv
uses: astral-sh/setup-uv@v7

- name: Cache pinned Hugging Face assets
uses: actions/cache@v4
with:
path: ~/.cache/huggingface
key: hf-renderers-${{ hashFiles('tests/model_assets.py') }}

- name: Install dependencies
run: uv sync

- name: Run text model parity tests
run: uv run pytest tests/ -m "network and not multimodal" -v

multimodal-parity:
name: Pinned multimodal parity
runs-on: ubuntu-latest
timeout-minutes: 45
env:
HF_HUB_DISABLE_PROGRESS_BARS: "1"
RENDERERS_TEST_NETWORK: "1"
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: "3.13"

Comment thread .github/workflows/test.yml Outdated
Comment on lines 76 to 103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants